/* eslint-disable */
export function array_column(arr, field, unique = false){
    if (arr.length === 0 || field.length === 0) return [];
    let result = [];
    for (let i in arr){
        if (typeof arr[i][field] === "undefined") continue;
        if (unique && result.includes(arr[i][field])) continue;
        result.push(arr[i][field]);
    }

    return result;
}



export function array_index(arr, key1, key2 = ''){
    if (arr.length === 0 || key1.length === 0) return [];
    let result = {};
    for (let i in arr){
        if (typeof arr[i][key1] === "undefined") continue;
        let v = key2.length ? arr[i][key2] : arr[i];
        result[arr[i][key1]] = v
    }

    return result;
}